<?php
	session_start();
	$connection = mysql_pconnect("localhost" , "root" , "31122001");
	mysql_select_db("kt_site");	
	$array = $_POST['devicestodelete'];
	if (!empty($array)) {
		$N = count($array);
		for ($i = 0 ; $i < $N ; $i++) {
			$device = $array[$i];
			$query = "DELETE FROM devices WHERE id = '".$device."';";
			$result = mysql_query($query);
		}
	}
	echo "<meta http-equiv='Refresh' content='0; URL=showdevices.php'>";
?>